package com.quanquan.user.service.autoCompute.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.Type;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 用户画像
 */
@Data
@Entity
@Table(name = "oo_label_group")
public class LabelGroup implements Serializable {

    /**
     * id
     */
    @Id
    @Column(name = "id", unique = true, nullable = false, length = 36)
    private String id;
    /**
     * 画像名称
     */
    @Column(name ="name",length = 60)
    private String name;

    @Column(name ="author",length = 60)
    private String author;

    @Column(name ="scene",length = 100)
    private String scene;

    /**
     * 描述
     */
    @Column(name = "description",length = 120)
    private String description;
    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "create_time")
    private Date createTime;
    /**
     * 修改时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "update_time")
    private Date updateTime;
    /**
     * 是否已经删除
     */
    @Type(type = "yes_no")
    @Column(name = "is_removed" ,columnDefinition = "CHAR(1) DEFAULT 'N'")
    private Boolean isRemoved;
    /**
     * 创建者
     */
    @Column(name = "belonging")
    private String belonging;
    /**
     * 包含人数
     */
    @Column(name = "contains_num")
    private Long containsNum;
    /**
     * 同步状态 1.同步中 2.同步完成 0.同步失败
     */
    @Column(name = "syn_status")
    private Integer synStatus;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "last_sync_time")
    private Date lastSyncTime;

    /**
     * 0 未推送， 1 推送成功， 2 推送失败， 3 推送中
     */
    @Column(name = "push_status" ,columnDefinition = "TINYINT(1) DEFAULT '0'")
    private Integer pushStatus;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "last_push_time")
    private Date lastPushTime;

    @Column(name = "push_success")
    private Long pushSuccess;

    @Column(name = "push_failed")
    private Long pushFailed;

    @Column(name = "push_total")
    private Long pushTotal;

    /**
     * 所有子标签
     */
    @Transient
    private List<MemberLabel> labels;

}
